﻿@model Zatify.WebUI.Admin.Models.AddNewUserViewModel

<script type="text/javascript">

    var addNewUserPopUp = new PopUp("addNewUser_Dialog", "overlay");

    $(document).ready(function () {

        $("#btnShowAddNewUser").click(function (e) {

            addNewUserPopUp.ShowDialog(true);
            e.preventDefault();
        });

        $("#btnClose, #btnCancel").click(function (e) {

            $("#addNewUser_Dialog").find("input[type=text], input[type=password]").each(function () {
                $(this).val("");
                $(this).removeClass("input-validation-error");
            });

            $("#addNewUser_Dialog").find("span.field-validation-error").each(function () {
                
                $(this).removeClass("field-validation-error").addClass("field-validation-valid");
            });

            addNewUserPopUp.CloseDialog();
            e.preventDefault();
        });
    })

    function onSuccess() {

        addNewUserPopUp.CloseDialog();
    }
</script>

<div id="addNewUser_Dialog" class="web_dialog">
    <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0">
        <tr>
            <td class="web_dialog_title">
                New User
            </td>
            <td class="web_dialog_title align_right">
                <a href="#" id="btnClose">X</a>
            </td>
        </tr>
        <tr>
            <td class="dialogContent" colspan="2" style="padding-left: 15px;">
                <div>
                    <fieldset>
                        <legend>
                            <h4>
                                Add New User</h4>
                        </legend>
                        
                        @*@using (Ajax.BeginForm("Add", "Users", new AjaxOptions() { InsertionMode = InsertionMode.Replace, UpdateTargetId = "result", OnSuccess="onSuccess" }))*@
                        @using (Html.BeginForm("Add", "Users", FormMethod.Post, new { id="addNewUserForm" }))
                        {
                            <div class="add_new_user_form">
                                <label class="apps_label_text">User ID:</label>
                                @Html.TextBoxFor(m => m.UserID, new { @class = "apps_inputbox" })
                                @Html.ValidationMessageFor(m => m.UserID, "*", new { title = "User ID is required and must be unique" })
                                <br />
                                <label class="apps_label_text">Password:</label>
                                @Html.PasswordFor(m => m.Password, new { @class = "apps_inputbox" })
                                <br />
                                <label class="apps_label_text">Confirm Password:</label>
                                @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "apps_inputbox" })
                                <br />
                                <label class="apps_label_text">Cell Phone:</label>
                                @Html.TextBoxFor(m => m.Phone, new { @class = "apps_inputbox" })
                                <br />
                                <label class="apps_label_text">Email:</label>
                                @Html.TextBoxFor(m => m.Email, new { @class = "apps_inputbox" })
                                <br />
                                <div class="zatify_panel_btn">
                                    <input id="btnSubmit" name="" type="submit" class="btn apps_btn apps_gray_btn" value="Save" />
                                    <input id="btnCancel" name="" type="button" class="btn apps_btn apps_gray_btn" value="Cancel" />
                                </div>
                            </div>
                        }
                    </fieldset>
                </div>
            </td>
        </tr>
    </table>
</div>